package com.duoec.dw.lineage.service.impl.desc;

import com.duoec.dw.lineage.dto.TableDescItem;
import com.duoec.dw.lineage.dto.TableDescReaderState;
import org.springframework.stereotype.Service;

import java.sql.ResultSet;

/**
 * @author xuwenzhen
 */
@Service
public class PartitionTableDescTypeProcessor extends FieldTableDescTypeProcessor {
    public static final String TYPE = "partition";

    /**
     * 需要处理的type类型
     *
     * @return type类型
     */
    @Override
    public String getType() {
        return TYPE;
    }

    /**
     * 处理一行数据
     *
     * @param state 当前的状态
     * @param rs    当前记录
     * @return 当行数据解析出来的TableDescItem实例
     */
    @Override
    public TableDescItem process(TableDescReaderState state, ResultSet rs) {
        TableDescItem item = super.process(state, rs);
        if (item != null) {
            item.setPartition(true);
        }
        return item;
    }
}
